import { reactive } from "vue";
import type { FormRules } from "element-plus";
// import { isPhone } from "@pureadmin/utils";

/** 自定义表单规则校验 */
export const formRules = reactive(<FormRules>{
	departmentId: [{ required: true, message: "部门为必填项", trigger: "blur" }],
	username: [{ required: true, message: "用户名为必填项", trigger: "blur" }],
	name: [{ required: true, message: "姓名为必填项", trigger: "blur" }],
	entryDate: [{ required: true, message: "入职时间为必填项", trigger: "change" }],
	phone: [{ required: true, message: "电话为必填项", trigger: "blur" }],
	email: [{ required: true, message: "邮箱为必填项", trigger: "blur" }],
	jobTitleId: [{ required: true, message: "职位为必填项", trigger: "change" }],
	gender: [{ required: true, message: "性别为必填项", trigger: "change" }],
	status: [{ required: true, message: "状态为必填项", trigger: "change" }],
	isSuperAdmin: [{ required: true, message: "是否为超级管理员为必填项", trigger: "change" }]
	// phone: [
	// 	{ required: true, message: "企业联系电话为必填项", trigger: "blur" },
	// 	{
	// 		validator: (rule, value, callback) => {
	// 			if (value === "") {
	// 				callback();
	// 			} else if (!isPhone(value)) {
	// 				callback(new Error("请输入正确的手机号码格式"));
	// 			} else {
	// 				callback();
	// 			}
	// 		},
	// 		trigger: "blur"
	// 	}
	// ]
});